<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../css/zk_random.css">
    <script src="../js/jquery-3.4.1.min.js"></script>
    <script src="../js/ejs.js"></script>
    <link rel="stylesheet" href="/css/zk_headerdll.css">
</head>
<body>
    <header>
        <div class="top_nov_list">
            <div class="w1200 taXian">
                <div class="top_nov_list_l1">
                    <a href="/html/zk_home.html">首页</a>
                    <a href="/html/Ljy.html?id=sales">好价</a>
                    <a href="/html/Lhaowu.html?id=goods">好物</a>
                    <a href="/html/haodian.html?id=shop">好店</a>
                    <a href="/html/Ltuangou.html?id=tuan">团购</a>
                </div>
                <div class="top_nov_list_l2">
                    <a href="/html/zk_sign.html">登录</a>
                    <a href="/html/zk_sign_in.html">注册</a>
                </div>
                <script>

                    var kill = document.querySelector(".top_nov_list_l2")
                    var condition = /\/.+\//
                    var arr = document.cookie.match(condition)
                    var user = ""
                    arr != null ? (function () {
                        arr.forEach(function (item) {
                            user = item.includes("user") ? item : ""
                        })
                        user = user.substring(user.indexOf("user=") + 5, user.length - 1)
                        if (user) {
                            kill.innerHTML = `
                            <a href="/html/zk_sign.html" class="user">${user}</a>
                            <a href="javascript:tuichu();">退出</a>`
                        }
                    })() : user = ""
                    function tuichu() {
                        var time = new Date()
                        time.setDate(time.getDate() - 1)
                        console.log(time)
                        document.cookie = `/user=${user}/;expires=${time}`
                        setTimeout(function () {
                            location.reload()
                        }, 800)
                    }
                </script>
                <script>
                    $(window).scroll(function () {
                        if ($("html").scrollTop() > 50) {
                            $(".top_nov_list").css("position", "fixed")
                        } else {
                            $(".top_nov_list").css("position", "relative")
                        }
                    })
                </script>
                <a href="">爆料投稿</a>
            </div>
        </div>
        <div class="top_nov_box">
            <div class="w1200 taXian">
                <div class="top_logo">
                    <a href="zk_home.html">
                        <img src="../img/zk_logo.png" alt="">
                    </a>
                    <p>分类导航</p>
                </div>
                <div class="top_inpu">
                    <form action="" class="taXian">
                        <div>
                            <input type="text" placeholder="请输入搜索关键字">
                        </div>
                        <input type="button" class="butt_box">
                    </form>
                    <script>
                        $(".top_inpu .butt_box").click(function (e) {
                            e.preventDefault()
                            location.href = `https://ai.taobao.com/search/index.htm?key=${$(".top_inpu div>input").val()}`
                        })
                    </script>
                    <ul class="top_inpu_nov">
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E9%259B%25AA%25E7%25BA%25BA%25E8%25A1%25AB%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">雪纺衫</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E5%25A5%25B3%25E5%258C%2585%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">女包</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E5%2587%2589%25E9%259E%258B%25E6%2596%25B0%25E5%2593%2581%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">凉鞋新品</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E7%259F%25AD%25E8%25A2%2596T%25E6%2581%25A4%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">短袖T恤</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E5%258D%258A%25E8%25BA%25AB%25E8%25A3%2599%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">半身裙</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E8%2596%2584%25E4%25B8%2583%25E5%2588%2586%25E8%25A3%25A4%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">薄七分裤</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E5%25B8%2586%25E5%25B8%2583%25E9%259E%258B%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">帆布鞋</a>
                        </li>
                        <li><a
                                href="http://redirect.simba.taobao.com/rd?f=http%3A%2F%2Fai.taobao.com%2Fsearch%2Findex.htm%3Fkey%3D%25E5%2587%2589%25E5%25B8%25AD%26pid%3Dmm_425760018_530150242_109137150485%26tmall%3Dtrue%26unid%3Dzm%26source_id%3Dtdj_search&amp;w=unionapijs&amp;p=mm_425760018_530150242_109137150485&amp;b=display_601_0_0_0_0&amp;c=cn&amp;pvid=0_0_0&amp;k=317b874644f98ccc">凉席</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </header>
    <main>
        <div class="class_list_box w1200">
            <div id="list_box_1" class="list_box_div">
                <span>分类：</span>
                <div id="l_list_box_1" class="l_list_box">
                    <a href="zk_random.html?id=c0">全部</a>
                    <a href="zk_random.html?id=c1">手机数码</a>
                    <a href="zk_random.html?id=c2">电脑办公</a>
                    <a href="zk_random.html?id=c3">钟表首饰</a>
                    <a href="zk_random.html?id=c4">美妆护肤</a>
                    <a href="zk_random.html?id=c5">家居日用</a>
                    <a href="zk_random.html?id=c6">家电影音</a>
                    <a href="zk_random.html?id=c7">服饰运动</a>
                    <a href="zk_random.html?id=c8">图书礼品</a>
                    <a href="zk_random.html?id=c9">零食饮品</a>
                    <a href="zk_random.html?id=c10">母婴玩具</a>
                    <a href="zk_random.html?id=c11">汽车用品</a>
                </div>
            </div>
            <div id="list_box_2" class="list_box_div">
                <span>筛选：</span>
                <div id="l_list_box_2" class="l_list_box">
                    <a href="zk_random.html?id=c0">手机数码<i></i></a>
                </div>
            </div>
        </div>
        <div class="dynamic_list_box w1200">
            <div class="title">
                <h3>精选好价</h3>
            </div>
            <div id="dynamic_list" class="taXian">
                <!-- <div class="dynamic_item">
                    <div class="pic_box">
                        <a href=""><img
                                src="https://img.alicdn.com/bao/uploaded/i3/1958184922/O1CN01CFuGij1mEK0L094mQ_!!0-item_pic.jpg_400x400q100.jpg"
                                alt=""></a>
                    </div>
                    <div class="pic_text">
                        <a href="">诺必行V3全面屏mp3随身听学生版蓝牙mp4hifi无损音乐播放器超薄mp5小型便携式录音笔mp6小巧电影下载可看小说</a>
                    </div>
                    <div class="foot_price">
                        <a href="">
                            <font class="f14">￥</font>
                            34.9 包邮
                            (需用券)
                        </a>
                    </div>
                    <div class="info_user">
                        <div class="info_user_left">
                            <a href="">
                                <span class="discounts_quan">领券</span>
                                <span class="discounts_price">满26元减3元</span>
                            </a>
                        </div>
                        <div class="info_user_rigt">
                            <a href="">去看看></a>
                        </div>
                    </div>
                </div> -->
            </div>
        </div>
    </main>
    <footer>
        <div class="w1200 taXian">
            <div class="foo_left">© 2020 中关村在线 版权所有</div>
            <ul class="foo_right taXian">
                <li><a href="">公司简介</a></li>
                <li><a href="">公司历程</a></li>
                <li><a href="">营销推广</a></li>
                <li><a href="">媒体合作</a></li>
                <li><a href="">品牌大全</a></li>
                <li><a href="">注册账号</a></li>
                <li><a href="">招聘信息</a></li>
                <li><a href="">联系方式</a></li>
                <li><a href="">隐私声名</a></li>
                <li><a href="">站点地图</a></li>
                <li><a href="" style="border-right:none">反馈纠错</a></li>
            </ul>
        </div>
        <div class="go_top">
            <script>
                $(window).scroll(function () {
                    if ($("html").scrollTop() > 400) {
                        $(".go_top").css("display", "block")
                    } else {
                        $(".go_top").css("display", "none")
                    }
                })
                $(".go_top").click(function () {
                    $("html").animate({ scrollTop: 0 }, 1000)
                })
            </script>
        </div>
    </footer>
    <script type="text/html" id="dynamic_list_box">
        <div class="dynamic_item">
            <div class="pic_box">
                <a href=""><img src="<%= data.img_src %>" alt=""></a>
            </div>
            <div class="pic_text">
                <a href=""><%= data.pic_text %></a>
            </div>
            <div class="foot_price">
                <%- data.foot_price %>
            </div>
            <div class="info_user">
                <div class="info_user_left">
                    <a href="">
                        <span class="discounts_quan">领券</span>
                        <span class="discounts_price"><%- data.discounts_price %></span>
                    </a>
                </div>
                <div class="info_user_rigt">
                    <a href="">去看看></a>
                </div>
            </div>
        </div>
    </script>
    <script>
        //取当前网页地址
        var ser = location.href
        //分割当前网页地址得到ID
        var id = ser.substring(ser.indexOf("id=") + 3)
        //发送GET请求获取当前ID的数据
        $.get("/php/wide.php", { id: id == "c0" ? "c1" : id }, function (res) {
            //启动渲染函数
            xunRan(JSON.parse(res))
        })
        function xunRan(data) {
            //将得到的数据闭包在当前函数中
            var l_data = data
            console.log(l_data)
            //进行一次调用.保证打开有数据
            l_xuanRan()
            function l_xuanRan() {
                //假设有N条.一次加载12条,如果剩余条数不足,则加载剩余条数
                var num = l_data.length > 12 ? 12 : l_data.length
                //进行循环,取出指定的条数
                for (var i = 0; i < num; i++) {
                    //用EJS模板处理数据,将得到的数据储存在变量中,以便后续便捷调用
                    var html = ejs.render($(`#dynamic_list_box`).html(), { data: l_data[i] })
                    //将本次得到的数据追加至指定模块中
                    $(`#dynamic_list`).append(html)
                }
                //进行二次循环,删除刚才取出的条数,保证数据不会重复
                for (var i = 0; i < num; i++) {
                    //数据是从前向后调用,所以删除头部
                    l_data.shift()
                }
            }
            $(window).scroll(function () {
                if ($(window).height() + $("html").scrollTop() >= $("html").height() - 100) {
                    l_xuanRan()
                }
            })
        }
    </script>
    <script>
        var data = $("#l_list_box_1>a")
        var num = id.substring(id.indexOf("c") + 1)
        num == 0 ? $("#list_box_2").hide() : $("#l_list_box_2 a").html(`${data[num].innerHTML}<i>`)
        //头部小样式
        $(window).scroll(function () {
            if ($("html").scrollTop() > 50) {
                $(".top_nov_list").css("position", "fixed")
            } else {
                $(".top_nov_list").css("position", "relative")
            }
        })
    </script>
</body>

</html>